package com.esri.core.geometry;

import com.esri.core.geometry.Geometry;
import com.github.mikephil.charting.utils.Utils;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class MultiPointImpl extends MultiVertexGeometryImpl {
    @Override // com.esri.core.geometry.MultiVertexGeometryImpl
    public boolean _buildRasterizedGeometryAccelerator(double d, Geometry.GeometryAccelerationDegree geometryAccelerationDegree) {
        return false;
    }

    @Override // com.esri.core.geometry.Geometry
    public Object _getImpl() {
        return this;
    }

    @Override // com.esri.core.geometry.MultiVertexGeometryImpl
    protected void _notifyModifiedAllImpl() {
    }

    @Override // com.esri.core.geometry.MultiVertexGeometryImpl
    protected void _verifyStreamsImpl() {
    }

    @Override // com.esri.core.geometry.MultiVertexGeometryImpl
    void a(MultiVertexGeometryImpl multiVertexGeometryImpl) {
    }

    @Override // com.esri.core.geometry.Geometry
    public double calculateArea2D() {
        return Utils.DOUBLE_EPSILON;
    }

    @Override // com.esri.core.geometry.Geometry
    public double calculateLength2D() {
        return Utils.DOUBLE_EPSILON;
    }

    @Override // com.esri.core.geometry.Geometry
    public int getDimension() {
        return 0;
    }

    public MultiPointImpl() {
        this.m_description = VertexDescriptionDesignerImpl.d();
        this.m_pointCount = 0;
    }

    public MultiPointImpl(VertexDescription vertexDescription) {
        if (vertexDescription == null) {
            throw new IllegalArgumentException();
        }
        this.m_description = vertexDescription;
        this.m_pointCount = 0;
    }

    @Override // com.esri.core.geometry.Geometry
    public Geometry createInstance() {
        return new MultiPoint(this.m_description);
    }

    public void add(Point point) {
        resize(this.m_pointCount + 1);
        setPoint(this.m_pointCount - 1, point);
    }

    public void add(double d, double d2) {
        resize(this.m_pointCount + 1);
        Point2D point2D = new Point2D();
        point2D.setCoords(d, d2);
        setXY(this.m_pointCount - 1, point2D);
    }

    public void add(double d, double d2, double d3) {
        resize(this.m_pointCount + 1);
        Point3D point3D = new Point3D();
        point3D.setCoords(d, d2, d3);
        setXYZ(this.m_pointCount - 1, point3D);
    }

    public void add(MultiVertexGeometryImpl multiVertexGeometryImpl, int i, int i2) {
        int pointCount = i2 < 0 ? multiVertexGeometryImpl.getPointCount() : i2;
        if (i < 0 || i > multiVertexGeometryImpl.getPointCount() || pointCount < i) {
            throw new IllegalArgumentException();
        }
        if (i == pointCount) {
            return;
        }
        mergeVertexDescription(multiVertexGeometryImpl.getDescription());
        int i3 = pointCount - i;
        int i4 = this.m_pointCount;
        resize(this.m_pointCount + i3);
        _verifyAllStreams();
        int attributeCount = multiVertexGeometryImpl.getDescription().getAttributeCount();
        for (int i5 = 0; i5 < attributeCount; i5++) {
            int _getSemanticsImpl = multiVertexGeometryImpl.getDescription()._getSemanticsImpl(i5);
            int componentCount = VertexDescription.getComponentCount(_getSemanticsImpl);
            AttributeStreamBase attributeStreamRef = getAttributeStreamRef(_getSemanticsImpl);
            AttributeStreamBase attributeStreamRef2 = multiVertexGeometryImpl.getAttributeStreamRef(_getSemanticsImpl);
            int i6 = i4 * componentCount;
            attributeStreamRef.insertRange(i6, attributeStreamRef2, i * componentCount, i3 * componentCount, true, 1, i6);
        }
    }

    public void addPoints(Point2D[] point2DArr) {
        int length = point2DArr.length;
        int i = this.m_pointCount;
        resize(this.m_pointCount + length);
        for (int i2 = 0; i2 < length; i2++) {
            setXY(i + i2, point2DArr[i2]);
        }
    }

    public void insertPoint(int i, Point point) {
        if (i > getPointCount()) {
            throw new GeometryException("index out of bounds");
        }
        if (i < 0) {
            i = getPointCount();
        }
        mergeVertexDescription(point.getDescription());
        int i2 = this.m_pointCount;
        d(this.m_pointCount + 1);
        _verifyAllStreams();
        int attributeCount = this.m_description.getAttributeCount();
        for (int i3 = 0; i3 < attributeCount; i3++) {
            int _getSemanticsImpl = this.m_description._getSemanticsImpl(i3);
            int componentCount = VertexDescription.getComponentCount(_getSemanticsImpl);
            AttributeStreamBase.createAttributeStreamWithSemantics(_getSemanticsImpl, 1);
            if (point.e(_getSemanticsImpl)) {
                this.b[i3].insertAttributes(componentCount * i, point, _getSemanticsImpl, componentCount * i2);
            } else {
                this.b[i3].insertRange(componentCount * i, VertexDescription.getDefaultValue(_getSemanticsImpl), componentCount, componentCount * i2);
            }
        }
        notifyModified(1013);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void a(int i) {
        if (i < 0 || i >= getPointCount()) {
            throw new GeometryException("index out of bounds");
        }
        _verifyAllStreams();
        int attributeCount = this.m_description.getAttributeCount();
        for (int i2 = 0; i2 < attributeCount; i2++) {
            if (this.b[i2] != null) {
                int componentCount = VertexDescription.getComponentCount(this.m_description._getSemanticsImpl(i2));
                this.b[i2].eraseRange(componentCount * i, componentCount, this.m_pointCount * componentCount);
            }
        }
        this.m_pointCount--;
        this.m_reservedPointCount--;
        notifyModified(1013);
    }

    public void resize(int i) {
        d(i);
    }

    @Override // com.esri.core.geometry.Geometry
    public void setEmpty() {
        super.l();
    }

    @Override // com.esri.core.geometry.Geometry
    public void applyTransformation(Transformation2D transformation2D) {
        if (isEmpty()) {
            return;
        }
        _verifyAllStreams();
        AttributeStreamOfDbl attributeStreamOfDbl = (AttributeStreamOfDbl) this.b[0];
        Point2D point2D = new Point2D();
        for (int i = 0; i < this.m_pointCount; i++) {
            int i2 = i * 2;
            point2D.x = attributeStreamOfDbl.read(i2);
            int i3 = i2 + 1;
            point2D.y = attributeStreamOfDbl.read(i3);
            transformation2D.a(point2D, point2D);
            attributeStreamOfDbl.write(i2, point2D.x);
            attributeStreamOfDbl.write(i3, point2D.y);
        }
        notifyModified(1013);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.esri.core.geometry.Geometry
    public void applyTransformation(Transformation3D transformation3D) {
        if (isEmpty()) {
            return;
        }
        _verifyAllStreams();
        addAttribute(1);
        _verifyAllStreams();
        AttributeStreamOfDbl attributeStreamOfDbl = (AttributeStreamOfDbl) this.b[0];
        AttributeStreamOfDbl attributeStreamOfDbl2 = (AttributeStreamOfDbl) this.b[1];
        Point3D point3D = new Point3D();
        for (int i = 0; i < this.m_pointCount; i++) {
            int i2 = i * 2;
            point3D.x = attributeStreamOfDbl.read(i2);
            int i3 = i2 + 1;
            point3D.y = attributeStreamOfDbl.read(i3);
            point3D.z = attributeStreamOfDbl2.read(i);
            Point3D transform = transformation3D.transform(point3D);
            attributeStreamOfDbl.write(i2, transform.x);
            attributeStreamOfDbl.write(i3, transform.y);
            attributeStreamOfDbl2.write(i, transform.z);
        }
        notifyModified(1013);
    }

    @Override // com.esri.core.geometry.Geometry
    public Geometry.Type getType() {
        return Geometry.Type.MULTIPOINT;
    }

    @Override // com.esri.core.geometry.MultiVertexGeometryImpl
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof MultiPointImpl) {
            return super.equals(obj);
        }
        return false;
    }

    public void addPoints(Point[] pointArr) {
        int length = pointArr.length;
        resize(this.m_pointCount + length);
        for (int i = 0; i < length; i++) {
            setPoint(i, pointArr[i]);
        }
    }

    public int queryCoordinates(Point2D[] point2DArr, int i, int i2, int i3) {
        if (i3 < 0) {
            i3 = this.m_pointCount;
        }
        int min = Math.min(i3, i2 + i);
        if (i2 < 0 || i2 >= this.m_pointCount || min < i2 || point2DArr.length != i) {
            throw new IllegalArgumentException();
        }
        int i4 = min - i2;
        int i5 = i4 * 2;
        double[] dArr = new double[i5];
        ((AttributeStreamOfDbl) getAttributeStreamRef(0)).readRange(i2 * 2, i5, dArr, 0, true);
        for (int i6 = 0; i6 < i4; i6++) {
            int i7 = i6 * 2;
            point2DArr[i6] = new Point2D(dArr[i7], dArr[i7 + 1]);
        }
        return min;
    }

    @Override // com.esri.core.geometry.MultiVertexGeometryImpl, com.esri.core.geometry.Geometry
    public boolean isValid() {
        return !isEmpty();
    }
}
